<?php
class User extends Model {
    protected $table = 'users';
    
    // 获取虚拟用户列表（示例数据）
    public function getDummyUsers() {
        return [
            ['id' => 1, 'name' => '张三', 'email' => 'zhangsan@example.com', 'age' => 28],
            ['id' => 2, 'name' => '李四', 'email' => 'lisi@example.com', 'age' => 32],
            ['id' => 3, 'name' => '王五', 'email' => 'wangwu@example.com', 'age' => 25],
            ['id' => 4, 'name' => '赵六', 'email' => 'zhaoliu@example.com', 'age' => 40]
        ];
    }
    
    // 根据ID获取虚拟用户（示例数据）
    public function getDummyUserById($id) {
        $users = $this->getDummyUsers();
        
        foreach ($users as $user) {
            if ($user['id'] == $id) {
                return $user;
            }
        }
        
        return null;
    }
    
    // 根据邮箱查询用户
    public function findByEmail($email) {
        return $this->db->query("SELECT * FROM {$this->table} WHERE email = ?", [$email]);
    }
}
?>